﻿#region Copyright Info

// 
// Majesty of Omega - The next evolution of macro management space strategy
// 
// Copyright 2007-2009 André Claaßen
// 
// This file is protected by the terms and conditions of the
// Microsoft Community License (Ms-CL 1.1), a copy of which should
// have been distributed along with this software. If not,
// you may find the license information at the following URL:
// 
// http://www.microsoft.com/resources/sharedsource/licensingbasics/communitylicense.mspx

#endregion

#region

using System;
using System.Globalization;
using System.Windows.Data;
using Majesty_of_Omega.Logic.Generator;
using Majesty_of_Omega.Config;

#endregion

namespace Majesty_of_Omega.GUI.ValueConverters
{
    /// <summary>
    /// Value Converter from a GalaxyConfiguration to a StarGalaxy object
    /// </summary>
    public class GalaxyConfigurationConverter : IValueConverter
    { 
        ///<summary>
        ///Converts a GalaxyConfiguration to a StarGalaxy.
        ///The data binding engine calls this method when it propagates a value from the binding source to the binding target.
        ///</summary>
        /// 
        ///<remarks>
        ///This Converter is used in the Step3_GameSettings.xaml page
        ///</remarks>
        /// 
        ///<returns>
        ///A converted value.If the method returns null, the valid null value is used.A return value of <see cref="T:System.Windows.DependencyProperty"></see>.<see cref="F:System.Windows.DependencyProperty.UnsetValue"></see> indicates that the converter produced no value and that the binding uses the <see cref="P:System.Windows.Data.BindingBase.FallbackValue"></see>, if available, or the default value instead.A return value of <see cref="T:System.Windows.Data.Binding"></see>.<see cref="F:System.Windows.Data.Binding.DoNothing"></see> indicates that the binding does not transfer the value or use the <see cref="P:System.Windows.Data.BindingBase.FallbackValue"></see> or default value.
        ///</returns>
        ///
        ///<param name="culture">The culture to use in the converter.</param>
        ///<param name="targetType">The type of the binding target property.</param>
        ///<param name="parameter">The converter parameter to use.</param>
        ///<param name="value">The value produced by the binding source.</param>
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            GalaxyGenerator generator = new GalaxyGenerator((GalaxyConfigurationsGalaxy) value);
            return generator.GeneratePreviewGalaxy();
        }

        ///<summary>
        ///Converts a value. The data binding engine calls this method when it propagates a value from the binding target to the binding source.
        ///</summary>
        ///
        ///<returns>
        ///A converted value.If the method returns null, the valid null value is used.A return value of <see cref="T:System.Windows.DependencyProperty"></see>.<see cref="F:System.Windows.DependencyProperty.UnsetValue"></see> indicates that the converter produced no value and that to the binding uses the <see cref="P:System.Windows.Data.BindingBase.FallbackValue"></see>, if available, or the default value instead.A return value of <see cref="T:System.Windows.Data.Binding"></see>.<see cref="F:System.Windows.Data.Binding.DoNothing"></see> indicates that the binding does not transfer the value or use the <see cref="P:System.Windows.Data.BindingBase.FallbackValue"></see> or default value.
        ///</returns>
        ///
        ///<param name="culture">The culture to use in the converter.</param>
        ///<param name="targetType">The type to convert to.</param>
        ///<param name="parameter">The converter parameter to use.</param>
        ///<param name="value">The value that is produced by the binding target.</param>
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}